package ar.com.larreta.persistencia;

import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.hibernate.criterion.SimpleExpression;

import com.extjs.gxt.ui.client.data.BaseFilterConfig;
import com.extjs.gxt.ui.client.data.BaseStringFilterConfig;

public class AdaptadorBaseStringFilterConfig implements AdaptadorFiltros {

	public SimpleExpression obtenerRestriccion(BaseFilterConfig filterConfig) {
		BaseStringFilterConfig stringFilterConfig = (BaseStringFilterConfig) filterConfig;
		return Restrictions.like(filterConfig.getField(), (String)filterConfig.getValue(), MatchMode.ANYWHERE);
	}

}
